//
//  HZCommon.h
//  HZTC_Stock
//
//  Created by MayerF on 17/3/9.
//  Copyright © 2017年 MayerF. All rights reserved.
//

#ifndef HZCommon_h
#define HZCommon_h

////////////////////////////////////////颜色相关//////////////////////////////////
#define kMYCustomColor(a,b,c,d) [UIColor colorWithRed:(a)/255.f green:(b)/255.f blue:(c)/255.f alpha:(d)]
//十六进制转grb
#define kMYHexToRGB(i,a) [UIColor colorWithRed:(i>>16&0xFF)/255.0 green:(i>>8&0xFF)/255.0 blue:(i&0xFF)/255.0 alpha:a]
//涨红跌绿颜色
#define kMYGetZhangDieColor(a,b)  (a == 0.f? kMYHexToRGB(0x888888,1):(a>b? kMYHexToRGB(0xff4040,1) : (a==b? kMYHexToRGB(0x888888,1):kMYHexToRGB(0x30ae0e,1))))
////////////////////////////////////////颜色相关//////////////////////////////////

////////////////////////////////////////屏幕相关//////////////////////////////////
#define ckSystemVersion [[[UIDevice currentDevice] systemVersion] floatValue]
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height
#define IPHONE_320W (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) == 320)
#define IPHONE_375W (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) == 375)
#define IPHONE_414W (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) == 414)
#define IPHONE_MOREW (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) > 414)
#define IPHONE_X  ([[UIScreen mainScreen] bounds].size.height == 812) || \
                  ([[UIScreen mainScreen] bounds].size.height == 896)
////////////////////////////////////////屏幕相关//////////////////////////////////


/// 安全执行block
#define kBLOCK_SAFE_EXEC(block, ...)   if(block){block(__VA_ARGS__);}

#define kWeakSelf __weak __typeof(self)weakSelf = self;

/// 安全执行block
#define kBLOCK_SAFE_EXEC(block, ...)   if(block){block(__VA_ARGS__);}


#endif /* HZCommon_h */

